﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections.Specialized;
using System.Web.Mvc;
using Project.Module;
using Project.Module.Common;
using Project.Module.DAO;
using Project.Module.DAO.BL;
using Project.Module.DAO.CMSBL;
using Project.Module.Model;
using Project.Module.Model.CMS;
using Project.Engine.Control;
using Project.Engine.Utilities;

namespace Project.Module.View.CMS
{
    public class CMSSearchUserView : BasePageRazor
    {
        public string keywordUsername = String.Empty;
        public string keywordEmail = String.Empty;
        public string choice = "0";
        public List<EmployeeModel> listEmployee { get; set; }
        private UserBL userBl = new UserBL();

        protected override void InitializePage()
        {
            base.InitializePage();

            if (Request["keywordUsername"] != null || Request["keywordEmail"] != null)
            {
                keywordUsername = Request["keywordUsername"] != "  " ? SecurityUtil.RemoveSqlInjection(Request["keywordUsername"].ToString()) : String.Empty;
                keywordEmail = Request["keywordEmail"] != "  " ? SecurityUtil.RemoveSqlInjection(Request["keywordEmail"].ToString()) : String.Empty;

                if (keywordUsername == String.Empty && keywordEmail == String.Empty)
                {
                    listEmployee = null;
                }
                else
                {
                    listEmployee = userBl.Search(keywordUsername, keywordEmail);
                }
            }
        }
    }
}
